package leetcodecompetition.D360;

/**
 * @Author: Siantar
 * @Date: 2023-08-27-10:37
 * @Description: 1.0
 */
public class T8022 {
    public long minimumPossibleSum(int n, int target) {
        int m;
        if (target % 2 == 0) m = target / 2;
        else if (target == 1) m = 1;
        else m = (target - 1) / 2;
        int t = 1;
        long res = 0;
        for (int i = 0; i < n; i++) {
            res += t;
            t++;
            if (t == m + 1) {
                t = target;
                if (target == 1) t++;
            }

        }
        return res;
    }
}
